package restful;

import static java.text.MessageFormat.*;

public class RestfulProtocolText {

	private StringBuilder stringBuilder = new StringBuilder();

	public RestfulProtocolText(RestfulProtocol protocol) {
		for(RestfulResource resource: protocol.getResources()) {
			for(RestfulMethod method: resource.getMethods()) {
				stringBuilder.append(format("{0} {1}\n", method.getVerb(), method.getPattern()));
			}
		}
	}

	@Override
	public String toString() {
		return stringBuilder.toString();
	}

}
